package com.hapoerpejb.services;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.HAPOERP_EJB.persistance.Competence;

/**
 * Session Bean implementation class CompetenceDAOImpl
 */
@Stateless
public class CompetenceDAOImpl implements CompetenceDAORemote, CompetenceDAOLocal {

    /**
     * Default constructor. 
     */
	
	@PersistenceContext(unitName ="HAPOERP_EJB")
	EntityManager em;
	
    public CompetenceDAOImpl() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public Competence findCompetenceById(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void removeCompetence(Competence ofe) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void updateCompetence(Competence ofe) {
		// TODO Auto-generated method stub
		
	}
	
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Competence> findAllCompetence() {
		// TODO Auto-generated method stub
		return em.createNamedQuery("Competence.findAll").getResultList();
	}

	@Override
	public void createCompetence(Competence ofe) {
		// TODO Auto-generated method stub
		
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Competence> findCompetenceByType(int d) {
		// TODO Auto-generated method stub
		return em.createNamedQuery("Competence.ByType").setParameter("var", d).getResultList();
	}

}
